package lanou.giftsay_01.main.categorymain;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import lanou.giftsay_01.R;
import lanou.giftsay_01.adapter.FenggeRvAdapter;
import lanou.giftsay_01.bean.NormalBean;
import lanou.giftsay_01.tools.BaseActivity;
import lanou.giftsay_01.tools.NetTool;
import lanou.giftsay_01.tools.URLValues;

/**
 * Created by dllo on 16/8/22.
 */
public class FenggeActivity  extends BaseActivity{

    private RecyclerView rv;
    private FenggeRvAdapter fenggeRvAdapter;
    private ImageView imageView;
    private int a;
    private int b;

    @Override
    public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
        super.onCreate(savedInstanceState, persistentState);



    }

    @Override
    protected int setLayout() {
        return R.layout.fengge_activity;
    }

    @Override
    protected void initView() {
        imageView = (ImageView) findViewById(R.id.search_backtwo);
        rv = (RecyclerView) findViewById(R.id.fengge_activity_rv);
        fenggeRvAdapter = new FenggeRvAdapter(this);
        GridLayoutManager manager = new GridLayoutManager(getApplicationContext() , 2);
        rv.setLayoutManager(manager);
    }

    @Override
    protected void initDate() {
        NetTool netTool = new NetTool();
        netTool.getNetData(URLValues.WANGGE, NormalBean.class, new NetTool.NetListener<NormalBean>() {
            @Override
            public void onSuccess(NormalBean normalBean) {
                fenggeRvAdapter.setNormalBean(normalBean);
                fenggeRvAdapter.setTag(0);
                rv.setAdapter(fenggeRvAdapter);

            }

            @Override
            public void onError(String errorMsg) {

            }
        });

     imageView.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View v) {
             finish();
         }
     });
    }
}
